{% extends 'web_template/default_two/templates/base.html' %}
{% block title %}{{ tlcms_content.data.title }}{% endblock %}
{% block keywords %}{{ tlcms_content.data.title }},{% for foo in tlcms_content.data.keyword %}{{ foo }},{% endfor %}{% endblock %}
{% block description %}{{ tlcms_content.data.description }}{% endblock %}
{% block content %}
    <link href="{{ 'css/comment.css'|tl_static }}" rel="stylesheet">
    <div class="weizhi">您现在的位置是：<a href="{{ url_for('webapp_bp.index_page') }}" title="{{ public.system.web_name }}">首页</a>&nbsp;&gt;&nbsp;<a
            href="{{ url_for('webapp_bp.list_article_page',cid=tlcms_content.data.PID_Id) }}" title="{{ tlcms_content.data.PID }}">{{ tlcms_content.data.PID }}</a></div>
    <div class="container">
        <h1>{{ tlcms_content.data.title }}</h1>
        <div class="info">
            <span>{{ tlcms_content.data.PID }}</span><span>作者：{{ tlcms_content.data.author }}</span><span>日期：{{ tlcms_content.data.update_time }}</span><span>点击：{{ tlcms_content.data.clicks }}</span>
        </div>
        <div class="content">
            {{ tlcms_content.data.content|safe }}
            <div class="pagelist"></div>
        </div>
        <div class="tags">
            {% for foo in tlcms_content.data.keyword %}
                <a href="{{ url_for('webapp_bp.tag_page',tag=foo) }}" target="_blank">{{ foo }}</a>
            {% endfor %}
        </div>
    </div>
    <div class="info-pre-next">
        <p>上一篇:<a href="{{ url_for('webapp_bp.article_page',uid=tlcms_content.last_page.ID) }}">{{ tlcms_content.last_page.title }}</a></p>
        <p>下一篇:<a href="{{ url_for('webapp_bp.article_page',uid=tlcms_content.next_page.ID) }}">{{ tlcms_content.next_page.title }}</a></p>
    </div>
    <div class="otherlink">
        <h2 class="news_t">相关文章</h2>
        <ul>
            {% for foo in tlcms_content.similar[:6] %}
                <li><a href="{{ url_for('webapp_bp.article_page',uid=foo.ID) }}" title="{{ foo.title }}">{{ foo.title }}</a></li>
            {% endfor %}
        </ul>
    </div>
    <div class="pinglun-box">
        <h2 class="news_t">文章评论</h2>
        <!-- 评论 开始 -->
        <div class="pinglun">
            <div class="pl-am">
                <div class="pl-area-post">
                    <div class="pl-post">
                        <form>
                            <div class="pl-textarea">
                                <textarea class="pl-post-word" placeholder="写下你想说的，开始我们的对话" name="comment_txt" id="comment_txt"></textarea>
                            </div>
                            <div class="pl-tools">
                                <ul>
                                    <li class="pl-tools-lastchild">
                                        <a class="pl-submit-btn" href="javascript:;" onclick="comment_post()">发 布</a>
                                    </li>
                                    <li class="username">
                                        <i></i><input type="text" class="pl-key" size="15" placeholder="你的昵称" name="user_name">
                                    </li>
                                </ul>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="pl-clr"></div>
                <div class="pl-header"><em>{{ tlcms_content.data.clicks }}</em>人参与，<em>{{ tlcms_content.comment_total }}</em>条评论</div>
                <div class="pl-show-list">
                    {% for foo in tlcms_content.commentList[:20] %}
                        <div class="lgy_no_data">
                            <p>来自《{{ foo.user_name }}》的评论：{{ foo.comment_txt }}<label style="float: right;">【{{ foo.create_time }}】</label></p>
                        </div>
                    {% endfor %}
                </div>
                <div class="pl-pagination"></div>
            </div>
        </div>
    </div>
    <script>
    function comment_post() {
          var data = $("form").serializeArray();
        $.ajax({
            url:'/comment_add/{{ tlcms_content.data.ID }}',
            type: 'POST',
            data: data,
            dataType: "json",
            success: function (data) {
                if (data.status === 0) {
                    document.getElementById("comment_txt").value="";
                    $('input[name="user_name"]').attr('value','');
                    alert(data.msg);
                    window.location.reload();
                } else {
                    alert(data.msg)
                }
            }, error: function () {
                alert('评论异常！')
            }
    })
      }
    </script>
{% endblock %}
